how to swap characters in a string in java